package com.efuture.druid;

import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.io.FileInputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.util.Properties;

/**
 * @ClassNAME DruidBaseUse
 * @Description Druid连接池的基本使用
 * @Author zhaoshanshan
 * @Date 2021/9/20 8:36 下午
 * @Version 1.0
 */
public class DruidBaseUse {
    public static void main(String[] args) {
        try {
            Properties pro = new Properties();
            InputStream is = DruidBaseUse.class.getClassLoader().getResourceAsStream("druid.properties");
            pro.load(is);
            DataSource ds = DruidDataSourceFactory.createDataSource(pro);
            Connection conn = ds.getConnection();
            System.out.println(conn);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

}